home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume25 / kit / part04 < prev    next >
Encoding:
Text File  |  1991-12-19  |  55.4 KB  |  2,416 lines

  1. Newsgroups: comp.sources.unix
  2. From: ram@eiffel.com (Raphael Manfredi)
  3. Subject: v25i052: kit - the ultimate mailing kit, Part04/04
  4. Sender: sources-moderator@pa.dec.com
  5. Approved: vixie@pa.dec.com
  6.  
  7. Submitted-By: ram@eiffel.com (Raphael Manfredi)
  8. Posting-Number: Volume 25, Issue 52
  9. Archive-Name: kit/part04
  10.  
  11. #! /bin/sh
  12. # This is a shell archive.  Remove anything before this line, then unpack
  13. # it by saving it into a file and typing "sh file".  To overwrite existing
  14. # files, type "sh file -c".  You can also feed this as standard input via
  15. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  16. # will see the following message at the end:
  17. #        "End of archive 4 (of 4)."
  18. # Contents:  Configure
  19. # Wrapped by vixie@cognition.pa.dec.com on Thu Dec 19 21:18:31 1991
  20. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  21. if test -f 'Configure' -a "${1}" != "-c" ; then 
  22.   echo shar: Will not clobber existing file \"'Configure'\"
  23. else
  24. echo shar: Extracting \"'Configure'\" \(53615 characters\)
  25. sed "s/^X//" >'Configure' <<'END_OF_FILE'
  26. X#! /bin/sh
  27. X#
  28. X# If these # comments don't work, trim them. Don't worry about any
  29. X# other shell scripts, Configure will trim # comments from them for you.
  30. X#
  31. X# (If you are trying to port this package to a machine without sh,
  32. X# I would suggest you have a look at the prototypical config.h.SH file
  33. X# and edit it to reflect your system. Some packages may include samples
  34. X# of config.h for certain machines, so you might look for one of those.)
  35. X#
  36. X# Yes, you may rip this off to use in other distribution packages. This
  37. X# script belongs to the public domain and cannot be copyrighted.
  38. X#
  39. X# (Note: this Configure script was generated automatically. Rather than
  40. X# working with this copy of Configure, you may wish to get metaconfig.
  41. X# Write to ram@eiffel.com (Raphael Manfredi) and I will send you the
  42. X# latest revision of the dist package, which includes metaconfig.)
  43. X
  44. X# $Id: Configure,v 2.0.1.4 91/11/25 15:48:25 ram Exp $
  45. X#
  46. X# Generated on Mon Nov 25 15:43:33 PST 1991 [metaconfig 2.8 PL11]
  47. X
  48. cat >/tmp/c1$$ <<EOF
  49. X
  50. ARGGGHHHH!!!!!
  51. X
  52. SCO csh still thinks true is false.  Write to SCO today and tell them that next
  53. year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
  54. X
  55. X(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
  56. we'd have to do is go in and swap the && and || tokens, wherever they are.)
  57. X
  58. X[End of diatribe.  We now return you to your regularly scheduled programming...]
  59. XEOF
  60. cat >/tmp/c2$$ <<EOF
  61. X
  62. OOPS!  You naughty creature!  You didn't run Configure with sh!
  63. I will attempt to remedy the situation by running sh for you...
  64. XEOF
  65. X
  66. true || cat /tmp/c1$$ /tmp/c2$$
  67. true || exec sh $0
  68. X
  69. export PATH || cat /tmp/c2$$
  70. export PATH || exec sh $0
  71. rm -f /tmp/c1$$ /tmp/c2$$
  72. X
  73. X: sanity checks
  74. PATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin"
  75. PATH=$PATH:'/usr/5bin:/etc:/usr/gnu/bin:/usr/new:/usr/new/bin:/usr/nbin'
  76. PATH=$PATH:'/sys5.3/bin:/sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb'
  77. PATH=$PATH:'/bsd4.3/usr/bin:/usr/bsd:/bsd43/bin'
  78. export PATH
  79. X
  80. if test ! -t 0; then
  81. X    echo "Say 'sh Configure', not 'sh <Configure'"
  82. X    exit 1
  83. fi
  84. X
  85. X(alias) >/dev/null 2>&1 && \
  86. X    echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
  87. X    echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
  88. X
  89. test -d UU || mkdir UU
  90. cd UU && rm -f *
  91. X
  92. case "$1" in
  93. X-d) shift; fastread='yes';;
  94. esac
  95. X
  96. d_eunice=''
  97. d_xenix=''
  98. d_bsd=''
  99. define=''
  100. eunicefix=''
  101. Mcc=''
  102. awk=''
  103. bison=''
  104. cat=''
  105. chgrp=''
  106. chmod=''
  107. chown=''
  108. compress=''
  109. cp=''
  110. cpio=''
  111. cpp=''
  112. csh=''
  113. date=''
  114. echo=''
  115. egrep=''
  116. emacs=''
  117. expr=''
  118. grep=''
  119. inews=''
  120. less=''
  121. line=''
  122. lint=''
  123. ln=''
  124. lp=''
  125. lpr=''
  126. ls=''
  127. mail=''
  128. mailx=''
  129. make=''
  130. mkdir=''
  131. more=''
  132. mv=''
  133. nroff=''
  134. perl=''
  135. pg=''
  136. pmake=''
  137. pr=''
  138. rm=''
  139. rmail=''
  140. sed=''
  141. sendmail=''
  142. sleep=''
  143. smail=''
  144. sort=''
  145. submit=''
  146. tail=''
  147. tar=''
  148. tbl=''
  149. test=''
  150. touch=''
  151. tr=''
  152. troff=''
  153. uname=''
  154. uniq=''
  155. uuname=''
  156. vi=''
  157. zcat=''
  158. Author=''
  159. Date=''
  160. Header=''
  161. Id=''
  162. Locker=''
  163. Log=''
  164. RCSfile=''
  165. Revision=''
  166. Source=''
  167. State=''
  168. bin=''
  169. byteorder=''
  170. cc=''
  171. ccflags=''
  172. ldflags=''
  173. cppflags=''
  174. optimize=''
  175. contains=''
  176. cppstdin=''
  177. cppminus=''
  178. d_getopt=''
  179. d_index=''
  180. d_memcpy=''
  181. d_memset=''
  182. d_portable=''
  183. d_voidsig=''
  184. signal_t=''
  185. defeditor=''
  186. i_string=''
  187. strings=''
  188. i_sysioctl=''
  189. i_bsdioctl=''
  190. i_syssockio=''
  191. d_voidtty=''
  192. i_termio=''
  193. i_sgtty=''
  194. i_termios=''
  195. libc=''
  196. nm_opt=''
  197. libpth=''
  198. plibpth=''
  199. libs=''
  200. mailer=''
  201. mansrc=''
  202. manext=''
  203. n=''
  204. c=''
  205. package=''
  206. privlib=''
  207. scriptdir=''
  208. spitshell=''
  209. shsharp=''
  210. sharpbang=''
  211. startsh=''
  212. sysman=''
  213. usrinc=''
  214. mips=''
  215. incpath=''
  216. mips_type=''
  217. voidflags=''
  218. defvoidused=''
  219. d_taropt_o=''
  220. large=''
  221. d_whoami=''
  222. i_sysselct=''
  223. CONFIG=''
  224. X: set package name
  225. package=kit
  226. X
  227. X: Eunice requires " " instead of "", can you believe it
  228. echo " "
  229. X: Here we go...
  230. echo "Beginning of configuration questions for $package kit."
  231. X
  232. define='define'
  233. undef='undef'
  234. smallmach='pdp11 i8086 z8000 i80286 iAPX286'
  235. rmlist='ark[1-9]isdone ark[1-9][0-9]isdone'
  236. trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3 15
  237. X
  238. X: We must find out about Eunice early
  239. eunicefix=':'
  240. if test -f /etc/unixtovms; then
  241. X    eunicefix=/etc/unixtovms
  242. fi
  243. if test -f /etc/unixtovms.exe; then
  244. X    eunicefix=/etc/unixtovms.exe
  245. fi
  246. X
  247. X: Find out which program gives a meaningful exit status
  248. if ls blurfl >/dev/null 2>&1; then
  249. X    if awk '' blurfl >/dev/null 2>&1; then
  250. X        check='cat'
  251. X    else
  252. X        check='awk ""'
  253. X    fi
  254. else
  255. X    check='ls'
  256. fi
  257. X
  258. X: Now test for existence of everything in MANIFEST
  259. echo " "
  260. if test -f ../MANIFEST; then
  261. X    echo "First let's make sure your kit is complete.  Checking..."
  262. X    : some grep do not return a proper exit status
  263. X    grep '^---' ../MANIFEST > .grepmani 2>/dev/null
  264. X    if test -s .grepmani; then
  265. X(cd ..; eval $check `awk '!/^.*\/$/{if (b) print $1}
  266. X/^---/{b=1}' MANIFEST` || kill $$) >/dev/null
  267. X    else
  268. X(cd ..; eval $check `awk '!/^.*\/$/{print $1}' MANIFEST` || kill $$) >/dev/null
  269. X    fi
  270. X    echo "Looks good..."
  271. else
  272. X    echo "No MANIFEST found. Hope your kit is complete !"
  273. fi
  274. rm -f .grepmani
  275. X
  276. X: list of known cpp symbols
  277. attrlist="DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__"
  278. attrlist="$attrlist _AIX __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
  279. attrlist="$attrlist hp9000s300 hp9000s500 hp9000s800 hpux"
  280. attrlist="$attrlist i186 i386 i486 i8086 iAPX286 ibm interdata"
  281. attrlist="$attrlist m88k mc300 mc500 mc68000 mc68k mc700 mert"
  282. attrlist="$attrlist mips ns16000 ns32000 nsc32000 os pdp11 posix pyr"
  283. attrlist="$attrlist sinix sony sparc sun tower tower32 tower32_600"
  284. attrlist="$attrlist tower32_800 tss u3b2 u3b20 u3b200 u3b5 ultrix unix"
  285. attrlist="$attrlist vax venix xenix z8000"
  286. X
  287. X: no include file wanted by default
  288. inclwanted=''
  289. X
  290. X: change the next line if compiling for Xenix/286 on Xenix/386
  291. xlibpath='/usr/lib/386 /lib/386'
  292. libpth='/usr/lib/large /lib '$xlibpth' /lib/large'
  293. libpth=$libpth' /usr/lib/small /lib/small'
  294. X
  295. X: full support for void wanted by default
  296. defvoidused=15
  297. X
  298. X
  299. X: some greps do not return status, grrr.
  300. echo "grimblepritz" >grimble
  301. if grep blurfldyick grimble >/dev/null 2>&1 ; then
  302. X    contains=contains
  303. elif grep grimblepritz grimble >/dev/null 2>&1 ; then
  304. X    contains=grep
  305. else
  306. X    contains=contains
  307. fi
  308. rm -f grimble
  309. X: the following should work in any shell
  310. case "$contains" in
  311. contains*)
  312. X    echo " "
  313. X    echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  314. X    cat >contains <<'EOSS'
  315. grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  316. XEOSS
  317. chmod +x contains
  318. esac
  319. X
  320. X: first determine how to suppress newline on echo command
  321. echo " "
  322. echo "Checking echo to see how to suppress newlines..."
  323. X(echo "hi there\c" ; echo " ") >.echotmp
  324. if $contains c .echotmp >/dev/null 2>&1 ; then
  325. X    echo "...using -n."
  326. X    n='-n'
  327. X    c=''
  328. else
  329. X    cat <<'EOM'
  330. X...using \c
  331. XEOM
  332. X    n=''
  333. X    c='\c'
  334. fi
  335. echo $n "The star should be here-->$c"
  336. echo '*'
  337. rm -f .echotmp
  338. X
  339. X: set up the echo used in my read
  340. myecho="case \"\$xxxm\" in
  341. X'') echo $n \"\$rp $c\";;
  342. X*) case \"\$rp\" in
  343. X    '') echo $n \"[\$xxxm] $c\";;
  344. X    *) echo $n \"\$rp [\$xxxm] $c\";;
  345. X    esac;;
  346. esac"
  347. X
  348. X: now set up to do reads with possible shell escape and default assignment
  349. cat <<EOSC >myread
  350. xxxm=\$dflt
  351. X$myecho
  352. case "\$fastread" in
  353. yes) case "\$dflt" in
  354. X    '') ans='!';;
  355. X    *) ans=''; echo " " ;;
  356. X    esac;;
  357. X*) ans='!';;
  358. esac
  359. while expr "X\$ans" : "X!" >/dev/null; do
  360. X    read answ
  361. X    set x \$xxxm
  362. X    shift
  363. X    aok=''; eval "ans=\"\$answ\"" && aok=y
  364. X    case  "\$answ" in
  365. X    "\$ans")
  366. X        case "\$ans" in
  367. X        !)
  368. X            sh
  369. X            echo " "
  370. X            $myecho
  371. X            ;;
  372. X        !*)
  373. X            set x \`expr "X\$ans" : "X!\(.*\)\$"\`
  374. X            shift
  375. X            sh -c "\$*"
  376. X            echo " "
  377. X            $myecho
  378. X            ;;
  379. X        esac;;
  380. X    *)
  381. X        case "\$aok" in
  382. X        y)
  383. X            echo "*** Substitution done -- please confirm."
  384. X            xxxm="\$ans"
  385. X            ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
  386. X            xxxm="\$ans"
  387. X            ans=!
  388. X            ;;
  389. X        *)
  390. X            echo "*** Error -- try again."
  391. X            ans=!
  392. X            ;;
  393. X        esac
  394. X        $myecho
  395. X        ;;
  396. X    esac
  397. done
  398. case "\$ans" in
  399. X'') ans="\$xxxm";;
  400. esac
  401. XEOSC
  402. X
  403. X: general instructions
  404. cat <<EOH
  405. This installation shell script will examine your system and ask you questions
  406. to determine how the kit package should be installed.  If you get stuck
  407. on a question, you may use a ! shell escape to start a subshell or execute a
  408. command.  Many of the questions will have default answers in square brackets;
  409. typing carriage return will give you the default.
  410. X
  411. On some of the questions which ask for file or directory names you are allowed
  412. to use the ~name construct to specify the login directory belonging to "name",
  413. even if you don't have a shell which knows about that.  Questions where this is
  414. allowed will be marked "(~name ok)".
  415. X
  416. XEOH
  417. rp=''
  418. dflt="Type carriage return to continue"
  419. X. myread
  420. cat <<'EOH'
  421. X
  422. The prompter used in this script allows you to use shell variables and
  423. backticks in your answers.  You may use $1, $2, etc...  to refer to the words
  424. in the default answer, as if the default line was a set of arguments given to a
  425. script shell.  This means you may also use $* to repeat the whole default line,
  426. so you do not have to re-type everything to add something to the default.
  427. X
  428. XEverytime there is a substitution, you will have to confirm.  If there is an
  429. error (e.g. an unmatched backtick), the default answer will remain unchanged
  430. and you will be prompted again.
  431. X
  432. If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
  433. the questions and use the computed defaults (or the previous answers if there
  434. was already a config.sh file).
  435. X
  436. XEOH
  437. X. myread
  438. cat <<EOH
  439. X
  440. Much effort has been expended to ensure that this shell script will run on any
  441. Unix system.  If despite that it blows up on yours, your best bet is to edit
  442. Configure and run it again.  Also, let me (ram@eiffel.com)
  443. know how I blew it.  If you can't run Configure for some reason, you'll have to
  444. generate a config.sh file by hand.
  445. X
  446. This installation script affects things in two ways:
  447. X
  448. X1) it may do direct variable substitutions on some of the files included
  449. X   in this kit.
  450. X2) it builds a config.h file for inclusion in C programs.  You may edit
  451. X   any of these files as the need arises after running this script.
  452. X
  453. If you make a mistake on a question, there is no easy way to back up to it
  454. currently.  The easiest thing to do is to edit config.sh and rerun all the SH
  455. files.  Configure will offer to let you do this before it runs the SH files.
  456. X
  457. XEOH
  458. dflt="Type carriage return to continue"
  459. X. myread
  460. X
  461. X: see if sh knows # comments
  462. echo " "
  463. echo "Checking your sh to see if it knows about # comments..."
  464. if sh -c '#' >/dev/null 2>&1 ; then
  465. X    echo "Your sh handles # comments correctly."
  466. X    shsharp=true
  467. X    spitshell=cat
  468. X    echo " "
  469. X    echo "Okay, let's see if #! works on this system..."
  470. X    echo "#!/bin/cat" >try
  471. X    $eunicefix try
  472. X    chmod +x try
  473. X    try > today
  474. X    if test -s today; then
  475. X        echo "It does."
  476. X        sharpbang='#!'
  477. X    else
  478. X        echo "#! /bin/cat" > try
  479. X        $eunicefix try
  480. X        chmod +x try
  481. X        try > today
  482. X        if test -s today; then
  483. X            echo "It does."
  484. X            sharpbang='#! '
  485. X        else
  486. X            echo "It doesn't."
  487. X            sharpbang=': use '
  488. X        fi
  489. X    fi
  490. else
  491. X    echo "Your sh doesn't grok # comments--I will strip them later on."
  492. X    shsharp=false
  493. X    echo "exec grep -v '^[     ]*#'" >spitshell
  494. X    chmod +x spitshell
  495. X    $eunicefix spitshell
  496. X    spitshell=`pwd`/spitshell
  497. X    echo "I presume that if # doesn't work, #! won't work either!"
  498. X    sharpbang=': use '
  499. fi
  500. rm -f try today
  501. X
  502. X: figure out how to guarantee sh startup
  503. echo " "
  504. echo "Checking out how to guarantee sh startup..."
  505. startsh=$sharpbang'/bin/sh'
  506. echo "Let's see if '$startsh' works..."
  507. cat >try <<EOSS
  508. X$startsh
  509. set abc
  510. test "$?abc" != 1
  511. XEOSS
  512. X
  513. chmod +x try
  514. X$eunicefix try
  515. if try; then
  516. X    echo "Yup, it does."
  517. else
  518. X    echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  519. fi
  520. rm -f try
  521. X
  522. X: find out where common programs are
  523. echo " "
  524. echo "Locating common programs..."
  525. cat <<EOSC >loc
  526. X$startsh
  527. case \$# in
  528. X0) exit 1;;
  529. esac
  530. thing=\$1
  531. shift
  532. dflt=\$1
  533. shift
  534. for dir in \$*; do
  535. X    case "\$thing" in
  536. X    .)
  537. X    if test -d \$dir/\$thing; then
  538. X        echo \$dir
  539. X        exit 0
  540. X    fi
  541. X    ;;
  542. X    *)
  543. X    if test -f \$dir/\$thing; then
  544. X        echo \$dir/\$thing
  545. X        exit 0
  546. X    elif test -f \$dir/\$thing.exe; then
  547. X        : on Eunice apparently
  548. X        echo \$dir/\$thing
  549. X        exit 0
  550. X    fi
  551. X    ;;
  552. X    esac
  553. done
  554. echo \$dflt
  555. exit 1
  556. XEOSC
  557. chmod +x loc
  558. X$eunicefix loc
  559. loclist="
  560. awk
  561. cat
  562. chgrp
  563. chmod
  564. chown
  565. echo
  566. expr
  567. grep
  568. mv
  569. rm
  570. sed
  571. tr
  572. X"
  573. trylist="
  574. Mcc
  575. cpp
  576. mail
  577. nroff
  578. rmail
  579. sendmail
  580. tar
  581. test
  582. uname
  583. vi
  584. X"
  585. pth=`echo $PATH | sed -e 's/:/ /g'`
  586. pth="$pth /lib /usr/lib"
  587. for file in $loclist; do
  588. X    xxx=`loc $file $file $pth`
  589. X    eval $file=$xxx
  590. X    eval _$file=$xxx
  591. X    case "$xxx" in
  592. X    /*)
  593. X    echo $file is in $xxx.
  594. X    ;;
  595. X    *)
  596. X    echo "I don't know where $file is.  I hope it's in everyone's PATH."
  597. X    ;;
  598. X    esac
  599. done
  600. echo " "
  601. echo "Don't worry if any of the following aren't found..."
  602. ans=offhand
  603. for file in $trylist; do
  604. X    xxx=`loc $file $file $pth`
  605. X    eval $file=$xxx
  606. X    eval _$file=$xxx
  607. X    case "$xxx" in
  608. X    /*)
  609. X    echo $file is in $xxx.
  610. X    ;;
  611. X    *)
  612. X    echo "I don't see $file out there, $ans."
  613. X    ans=either
  614. X    ;;
  615. X    esac
  616. done
  617. case "$egrep" in
  618. egrep)
  619. X    echo "Substituting grep for egrep."
  620. X    egrep=$grep
  621. X    ;;
  622. esac
  623. case "$test" in
  624. test)
  625. X    echo "Hopefully test is built into your sh."
  626. X    ;;
  627. X/bin/test)
  628. X    if sh -c "PATH= test true" >/dev/null 2>&1; then
  629. X    echo "Using the test built into your sh."
  630. X    test=test
  631. X    fi
  632. X    ;;
  633. X*)
  634. X    test=test
  635. X    ;;
  636. esac
  637. case "$echo" in
  638. echo)
  639. X    echo "Hopefully echo is built into your sh."
  640. X    ;;
  641. X/bin/echo)
  642. X    echo " "
  643. X    echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
  644. X    $echo $n "hi there$c" >foo1
  645. X    echo $n "hi there$c" >foo2
  646. X    if cmp foo1 foo2 >/dev/null 2>&1; then
  647. X    echo "They are compatible.  In fact, they may be identical."
  648. X    else
  649. X    case "$n" in
  650. X    '-n') n='' c='\c';;
  651. X    *) n='-n' c='';;
  652. X    esac
  653. X    cat <<FOO
  654. They are not compatible!  You are probably running ksh on a non-USG system.
  655. I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
  656. have echo built in and we may have to run some Bourne shell scripts.  That
  657. means I'll have to use $ans to suppress newlines now.  Life is ridiculous.
  658. X
  659. XFOO
  660. X    $echo $n "The star should be here-->$c"
  661. X    $echo "*"
  662. X    fi
  663. X    $rm -f foo1 foo2
  664. X    ;;
  665. X*)
  666. X    : cross your fingers
  667. X    echo=echo
  668. X    ;;
  669. esac
  670. rmlist="$rmlist loc"
  671. X
  672. X: get old answers, if there is a config file out there
  673. hint=default
  674. if test -f ../config.sh; then
  675. X    echo " "
  676. X    dflt=y
  677. X    rp="I see a config.sh file.  Did Configure make it on THIS system?"
  678. X    . myread
  679. X    case "$ans" in
  680. X    n*|N*) echo "OK, I'll ignore it.";;
  681. X    *)  echo "Fetching default answers from your old config.sh file..."
  682. X        tmp="$n"
  683. X        ans="$c"
  684. X        . ../config.sh
  685. X        cp ../config.sh .
  686. X        n="$tmp"
  687. X        c="$ans"
  688. X        ;;
  689. X    esac
  690. fi
  691. X
  692. X: Restore computed paths
  693. for file in $loclist $trylist; do
  694. X    eval $file="\$_$file"
  695. done
  696. X
  697. X: set up shell script to do ~ expansion
  698. cat >filexp <<EOSS
  699. X$startsh
  700. X: expand filename
  701. case "\$1" in
  702. X ~/*|~)
  703. X    echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  704. X    ;;
  705. X ~*)
  706. X    if $test -f /bin/csh; then
  707. X    /bin/csh -f -c "glob \$1"
  708. X    echo ""
  709. X    else
  710. X    name=\`$expr x\$1 : '..\([^/]*\)'\`
  711. X    dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
  712. X    if $test ! -d "\$dir"; then
  713. X        me=\`basename \$0\`
  714. X        echo "\$me: can't locate home directory for: \$name" >&2
  715. X        exit 1
  716. X    fi
  717. X    case "\$1" in
  718. X    */*)
  719. X        echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  720. X        ;;
  721. X    *)
  722. X        echo \$dir
  723. X        ;;
  724. X    esac
  725. X    fi
  726. X    ;;
  727. X*)
  728. X    echo \$1
  729. X    ;;
  730. esac
  731. XEOSS
  732. chmod +x filexp
  733. X$eunicefix filexp
  734. X
  735. X: determine where manual pages are on this system
  736. echo " "
  737. case "$sysman" in
  738. X'') sysman=`loc . /usr/man/man1 /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/share/man/man1 /usr/catman/u_man/man1 /usr/man/l_man/man1 /usr/local/man/u_man/man1 /usr/local/man/l_man/man1 /usr/man/man.L`
  739. X    ;;
  740. esac
  741. if test -d "$sysman"; then
  742. X    echo "System manual is in $sysman."
  743. else
  744. X    echo "Could not find manual pages in source form."
  745. fi
  746. X
  747. X: make some quick guesses about what we are up against
  748. echo " "
  749. X$echo $n "Hmm...  $c"
  750. X$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
  751. if test `echo abc | tr a-z A-Z` = Abc ; then
  752. X    xxx=`./loc addbib blurfl $pth`
  753. X    if $test -f $xxx; then
  754. X        echo "Looks kind of like a USG system with BSD features, but we'll see..."
  755. X        echo exit 0 >bsd
  756. X        echo exit 0 >usg
  757. X        echo exit 1 >v7
  758. X    else
  759. X        if $contains SIGTSTP foo >/dev/null 2>&1 ; then
  760. X            echo "Looks kind of like an extended USG system, but we'll see..."
  761. X        else
  762. X            echo "Looks kind of like a USG system, but we'll see..."
  763. X        fi
  764. X        echo exit 1 >bsd
  765. X        echo exit 0 >usg
  766. X        echo exit 1 >v7
  767. X    fi
  768. X    d_bsd="$undef"
  769. elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
  770. X    echo "Looks kind of like a BSD system, but we'll see..."
  771. X    d_bsd="$define"
  772. X    echo exit 0 >bsd
  773. X    echo exit 1 >usg
  774. X    echo exit 1 >v7
  775. else
  776. X    echo "Looks kind of like a Version 7 system, but we'll see..."
  777. X    d_bsd="$undef"
  778. X    echo exit 1 >bsd
  779. X    echo exit 1 >usg
  780. X    echo exit 0 >v7
  781. fi
  782. case "$eunicefix" in
  783. X*unixtovms*)
  784. X    cat <<'EOI'
  785. There is, however, a strange, musty smell in the air that reminds me of
  786. something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  787. XEOI
  788. X    echo "exit 0" >eunice
  789. X    eunicefix=unixtovms
  790. X    d_eunice="$define"
  791. X: it so happens the Eunice I know will not run shell scripts in Unix format
  792. X    ;;
  793. X*)
  794. X    echo " "
  795. X    echo "Congratulations.  You aren't running Eunice."
  796. X    eunicefix=':'
  797. X    d_eunice="$undef"
  798. X    echo "exit 1" >eunice
  799. X    ;;
  800. esac
  801. if test -f /xenix; then
  802. X    echo "Actually, this looks more like a XENIX system..."
  803. X    echo "exit 0" >xenix
  804. X    d_xenix="$define"
  805. else
  806. X    echo " "
  807. X    echo "It's not Xenix..."
  808. X    echo "exit 1" >xenix
  809. X    d_xenix="$undef"
  810. fi
  811. chmod +x xenix
  812. X$eunicefix xenix
  813. if test -f /venix; then
  814. X    echo "Actually, this looks more like a VENIX system..."
  815. X    echo "exit 0" >venix
  816. else
  817. X    echo " "
  818. X    if xenix; then
  819. X    : null
  820. X    else
  821. X    echo "Nor is it Venix..."
  822. X    fi
  823. X    echo "exit 1" >venix
  824. fi
  825. chmod +x bsd usg v7 eunice venix
  826. X$eunicefix bsd usg v7 eunice venix
  827. X$rm -f foo
  828. rmlist="$rmlist bsd usg v7 eunice venix xenix"
  829. X
  830. X: see if we need a special compiler
  831. echo " "
  832. if usg; then
  833. X    case "$cc" in
  834. X    '') case "$Mcc" in
  835. X        /*) dflt='Mcc';;
  836. X        *) case "$large" in
  837. X            -M*) dflt='cc';;
  838. X            *)    if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
  839. X                    if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
  840. X                        dflt='cc'
  841. X                    else
  842. X                        dflt='cc -M'
  843. X                    fi
  844. X                else
  845. X                    dflt='cc'
  846. X                fi;;
  847. X            esac;;
  848. X        esac;;
  849. X    *)  dflt="$cc";;
  850. X    esac
  851. X    $cat <<'EOM'
  852. On some systems the default C compiler will not resolve multiple global
  853. references that happen to have the same name.  On some such systems the "Mcc"
  854. command may be used to force these to be resolved.  On other systems a "cc -M"
  855. command is required.  (Note that the -M flag on other systems indicates a
  856. memory model to use!) If you have the Gnu C compiler, you might wish to use
  857. that instead.
  858. X
  859. XEOM
  860. X    rp="What command will force resolution on this system?"
  861. X    . myread
  862. X    cc="$ans"
  863. else
  864. X    case "$cc" in
  865. X    '') dflt=cc;;
  866. X    *) dflt="$cc";;
  867. X    esac
  868. X    rp="Use which C compiler?"
  869. X    . myread
  870. X    cc="$ans"
  871. fi
  872. case "$cc" in
  873. gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
  874. esac
  875. X
  876. X: What should the include directory be ?
  877. echo " "
  878. X$echo $n "Hmm...  $c"
  879. case "$usrinc" in
  880. X'') dflt='/usr/include';;
  881. X*) dflt=$usrinc;;
  882. esac
  883. incpath=''
  884. mips_type=''
  885. if $test -f /bin/mips && /bin/mips; then
  886. X    echo "Looks like a MIPS system..."
  887. X    $cat >usr.c <<'EOCP'
  888. X#ifdef SYSTYPE_BSD43
  889. X/bsd43
  890. X#endif
  891. XEOCP
  892. X    if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
  893. X        dflt='/bsd43/usr/include'
  894. X        incpath='/bsd43'
  895. X        mips_type='BSD 4.3'
  896. X    else
  897. X        mips_type='System V'
  898. X    fi
  899. X    echo "and you're compiling with the $mips_type compiler and libraries."
  900. else
  901. X    echo "Doesn't look like a MIPS system."
  902. X    echo "exit 1" >mips
  903. X    chmod +x mips
  904. X    $eunicefix mips
  905. fi
  906. cont=true
  907. while $test "$cont"; do
  908. X    echo " "
  909. X    rp="Where are the include files you want to use?"
  910. X    . myread
  911. X    usrinc="$ans"
  912. X    if $test -d "$ans"; then
  913. X        cont=''
  914. X    else
  915. X        if $test "$fastread" = yes; then
  916. X            dflt=y
  917. X        else
  918. X            dflt=n
  919. X        fi
  920. X        rp="Directory $ans doesn't exist.  Use that name anyway?"
  921. X        . myread
  922. X        dflt=''
  923. X        case "$ans" in
  924. X        y*) cont='';;
  925. X        esac
  926. X    fi
  927. done
  928. X$rm -f usr.c usr.out
  929. X
  930. X: determine optimize, if desired, or use for debug flag also
  931. case "$optimize" in
  932. X' ') dflt="none";;
  933. X'') dflt="-O";;
  934. X*) dflt="$optimize";;
  935. esac
  936. X$cat <<EOH
  937. X
  938. Some C compilers have problems with their optimizers, by default, $package
  939. compiles with the -O flag to use the optimizer.  Alternately, you might want to
  940. use the symbolic debugger, which uses the -g flag (on traditional Unix systems).
  941. XEither flag can be specified here. To use neither flag, specify the word "none".
  942. X
  943. XEOH
  944. rp="What optimizer/debugger flag should be used?"
  945. X. myread
  946. optimize="$ans"
  947. case "$optimize" in
  948. X'none') optimize=" ";;
  949. esac
  950. X
  951. case "$ccflags" in
  952. X'') case "$cc" in
  953. X    *gcc*) dflt='-fpcc-struct-return';;
  954. X    *) dflt='';;
  955. X    esac
  956. X    ;;
  957. X*) dflt="$ccflags"
  958. X    case "$cc" in
  959. X    *gcc*) case "$dflt" in
  960. X        *-fpcc-struct-return*) ;;
  961. X        *) dflt="$dflt -fpcc-struct-return";;
  962. X        esac;;
  963. X    esac;;
  964. esac
  965. X
  966. case "$mips_type" in
  967. X*BSD*) ;;
  968. X'') ;;
  969. X*) inclwanted="$inclwanted $usrinc/bsd";;
  970. esac
  971. for thisincl in $inclwanted; do
  972. X    if $test -d $thisincl; then
  973. X        if $test x$thisincl != x$usrinc; then
  974. X            case "$dflt" in
  975. X            *$thisincl*);;
  976. X            *) dflt="$dflt -I$thisincl";;
  977. X            esac
  978. X        fi
  979. X    fi
  980. done
  981. X
  982. case "$optimize" in
  983. X-g*)
  984. X    case "$dflt" in
  985. X    *DEBUG*);;
  986. X    *) dflt="$dflt -DDEBUG";;
  987. X    esac
  988. X    ;;
  989. esac
  990. if $contains 'LANGUAGE_C' $usrinc/signal.h >/dev/null 2>&1; then
  991. X    case "$dflt" in
  992. X    *LANGUAGE_C*);;
  993. X    *) dflt="$dflt -DLANGUAGE_C";;
  994. X    esac
  995. elif $contains 'LANGUAGE_C' $usrinc/sys/signal.h >/dev/null 2>&1; then
  996. X    case "$dflt" in
  997. X    *LANGUAGE_C*);;
  998. X    *) dflt="$dflt -DLANGUAGE_C";;
  999. X    esac
  1000. fi
  1001. if $contains '_NO_PROTO' $usrinc/signal.h >/dev/null 2>&1; then
  1002. X    case "$dflt" in
  1003. X    *_NO_PROTO*);;
  1004. X    *) dflt="$dflt -D_NO_PROTO";;
  1005. X    esac
  1006. elif $contains '_NO_PROTO' $usrinc/sys/signal.h >/dev/null 2>&1; then
  1007. X    case "$dflt" in
  1008. X    *_NO_PROTO*);;
  1009. X    *) dflt="$dflt -D_NO_PROTO";;
  1010. X    esac
  1011. fi
  1012. case "$dflt" in
  1013. X'') dflt=none;;
  1014. esac
  1015. X$cat <<EOH
  1016. X
  1017. Your C compiler may want other flags.  For this question you should include
  1018. X-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
  1019. but you should NOT include libraries or ld flags like -lwhatever.  To use no
  1020. flags, specify the word "none".
  1021. X
  1022. XEOH
  1023. set X $dflt
  1024. shift
  1025. dflt=${1+"$@"}
  1026. rp="Any additional cc flags?"
  1027. X. myread
  1028. case "$ans" in
  1029. none) ans='';
  1030. esac
  1031. ccflags="$ans"
  1032. X
  1033. X: the following weeds options from ccflags that are of no interest to cpp
  1034. cppflags="$ccflags"
  1035. case "$cc" in
  1036. X*gcc*) cppflags="$cppflags -D__GNUC__";;
  1037. esac
  1038. case "$mips_type" in
  1039. X'');;
  1040. X*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
  1041. esac
  1042. case "$cppflags" in
  1043. X'');;
  1044. X*)  set X $cppflags
  1045. X    cppflags=''
  1046. X    for flag do
  1047. X        case $flag in
  1048. X        -D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
  1049. X        esac
  1050. X    done
  1051. X    case "$cppflags" in
  1052. X    *-*)  echo "(C preprocessor flags: $cppflags)";;
  1053. X    esac
  1054. X    ;;
  1055. esac
  1056. X
  1057. case "$ldflags" in
  1058. X'') if venix; then
  1059. X        dflt='-i -z'
  1060. X    else
  1061. X        dflt='none'
  1062. X    fi
  1063. X    ;;
  1064. X*) dflt="$ldflags";;
  1065. esac
  1066. echo " "
  1067. rp="Any additional ld flags (NOT including libraries)?"
  1068. X. myread
  1069. case "$ans" in
  1070. none) ans='';
  1071. esac
  1072. ldflags="$ans"
  1073. rmlist="$rmlist pdp11"
  1074. X
  1075. X: check for ordering of bytes in a long
  1076. case "$byteorder" in
  1077. X'')
  1078. X$cat <<'EOM'
  1079. X  
  1080. In the following, larger digits indicate more significance.  A big-endian
  1081. machine like a Pyramid or a Motorola 680?0 chip will come out to 4321.  A
  1082. little-endian machine like a Vax or an Intel 80?86 chip would be 1234.  Other
  1083. machines may have weird orders like 3412.  A Cray will report 87654321.  If
  1084. the test program works the default is probably right.
  1085. I'm now running the test program...
  1086. XEOM
  1087. X    $cat >try.c <<'EOCP'
  1088. X#include <stdio.h>
  1089. main()
  1090. X{
  1091. X    int i;
  1092. X    union {
  1093. X    unsigned long l;
  1094. X    char c[sizeof(long)];
  1095. X    } u;
  1096. X
  1097. X    if (sizeof(long) > 4)
  1098. X    u.l = (0x08070605<<32) | 0x04030201;
  1099. X    else
  1100. X    u.l = 0x04030201;
  1101. X    for (i=0; i < sizeof(long); i++)
  1102. X    printf("%c",u.c[i]+'0');
  1103. X    printf("\n");
  1104. X}
  1105. XEOCP
  1106. X    if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
  1107. X    dflt=`./try`
  1108. X    case "$dflt" in
  1109. X    ????|????????) echo "(The test program ran ok.)";;
  1110. X    *) echo "(The test program didn't run right for some reason.)";;
  1111. X    esac
  1112. X    else
  1113. X    dflt='4321'
  1114. X    echo "(I can't seem to compile the test program.  Guessing big-endian...)"
  1115. X    fi
  1116. X    ;;
  1117. X*)
  1118. X    echo " "
  1119. X    dflt="$byteorder"
  1120. X    ;;
  1121. esac
  1122. rp="What is the order of bytes in a long?"
  1123. X. myread
  1124. byteorder="$ans"
  1125. X$rm -f try.c try
  1126. X
  1127. X: Set private lib path
  1128. case "$plibpth" in
  1129. X'') if mips; then
  1130. X        plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
  1131. X    else
  1132. X        plibpth="/usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib"
  1133. X    fi;;
  1134. esac
  1135. libpth="$plibpth $libpth"
  1136. X
  1137. X: Looking for optional libraries
  1138. echo " "
  1139. echo "Checking for optional libraries..."
  1140. case "$libs" in
  1141. X'') dflt='';;
  1142. X*) dflt="$libs";;
  1143. esac
  1144. case "$libswanted" in
  1145. X'') libswanted='c_s';;
  1146. esac
  1147. for thislib in $libswanted; do
  1148. X    case "$thislib" in
  1149. X    dbm) thatlib=ndbm;;
  1150. X    *_s) thatlib=NONE;;
  1151. X    *) thatlib="${thislib}_s";;
  1152. X    *) thatlib=NONE;;
  1153. X    esac
  1154. X    yyy="$incpath/usr/ccs/lib $incpath/usr/lib $incpath/usr/ucblib"
  1155. X    yyy="$yyy $incpath/usr/local/lib $incpath/lib"
  1156. X    xxx=`loc lib$thislib.a X $yyy`
  1157. X    if $test -f $xxx; then
  1158. X        echo "Found -l$thislib."
  1159. X        case "$dflt" in
  1160. X        *-l$thislib*|*-l$thatlib*);;
  1161. X        *) dflt="$dflt -l$thislib";;
  1162. X        esac
  1163. X    else
  1164. X        xxx=`loc lib$thislib.a X $libpth`
  1165. X        if $test -f $xxx; then
  1166. X            echo "Found $xxx."
  1167. X            case "$dflt" in
  1168. X            *$xxx*);;
  1169. X            *) dflt="$dflt $xxx";;
  1170. X            esac
  1171. X        else
  1172. X            xxx=`loc Slib$thislib.a X $xlibpth`
  1173. X            if $test -f $xxx; then
  1174. X                echo "Found -l$thislib."
  1175. X                case "$dflt" in
  1176. X                *-l$thislib*|*-l$thatlib*);;
  1177. X                *) dflt="$dflt -l$thislib";;
  1178. X                esac
  1179. X            else
  1180. X                echo "No -l$thislib."
  1181. X            fi
  1182. X        fi
  1183. X    fi
  1184. done
  1185. set X $dflt
  1186. shift
  1187. dflt="$*"
  1188. case "$libs" in
  1189. X'') dflt="$dflt";;
  1190. X*) dflt="$libs";;
  1191. esac
  1192. case "$dflt" in
  1193. X'') dflt='none';;
  1194. esac
  1195. X
  1196. X$cat <<EOM
  1197. Some versions of Unix support shared libraries, which make executables smaller
  1198. but make load time slightly longer.
  1199. X
  1200. On some systems, mostly newer Unix System V's, the shared library is included
  1201. by putting the option "-lc_s" as the last thing on the cc command line when
  1202. linking.  Other systems use shared libraries by default.  There may be other
  1203. libraries needed to compile $package on your machine as well.  If your system
  1204. needs the "-lc_s" option, include it here.  Include any other special libraries
  1205. here as well.  Say "none" for none.
  1206. XEOM
  1207. X
  1208. echo " "
  1209. rp="Any additional libraries?"
  1210. X. myread
  1211. case "$ans" in
  1212. none) ans='';
  1213. esac
  1214. libs="$ans"
  1215. X
  1216. X: get list of predefined functions in a handy place
  1217. echo " "
  1218. case "$libc" in
  1219. X'') libc=unknown;;
  1220. esac
  1221. case "$nm_opt" in
  1222. X'') if $test -f /mach_boot; then
  1223. X        nm_opt=''
  1224. X    elif $test -d /usr/ccs/lib; then
  1225. X        nm_opt='-p'
  1226. X    else
  1227. X        nm_opt=''
  1228. X    fi;;
  1229. esac
  1230. libpth="$plibpth $libpth"
  1231. case "$libs" in
  1232. X*-lc_s*) libc=`loc libc_s.a $libc $libpth`
  1233. esac
  1234. libnames='';
  1235. case "$libs" in
  1236. X'') ;;
  1237. X*)  for thislib in $libs; do
  1238. X    case "$thislib" in
  1239. X    -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
  1240. X        try=`loc lib$thislib.a blurfl/dyick $libpth`
  1241. X        if test ! -f $try; then
  1242. X        try=`loc lib$thislib blurfl/dyick $libpth`
  1243. X        if test ! -f $try; then
  1244. X            try=`loc $thislib blurfl/dyick $libpth`
  1245. X            if test ! -f $try; then
  1246. X            try=`loc Slib$thislib.a blurfl/dyick $xlibpth`
  1247. X            if test ! -f $try; then
  1248. X                try=''
  1249. X            fi
  1250. X            fi
  1251. X        fi
  1252. X        fi
  1253. X        libnames="$libnames $try"
  1254. X        ;;
  1255. X    *) libnames="$libnames $thislib" ;;
  1256. X    esac
  1257. X    done
  1258. X    ;;
  1259. esac
  1260. set /usr/ccs/lib/libc.so
  1261. X$test -f $1 || set /usr/lib/libc.so
  1262. X$test -f $1 || set /usr/lib/libc.so.[0-9]*
  1263. X$test -f $1 || set /lib/libsys_s.a
  1264. eval set \$$#
  1265. if test -f "$1"; then
  1266. X    echo "Your (shared) C library seems to be in $1."
  1267. X    libc="$1"
  1268. elif test -f /lib/libc && test -f /lib/clib; then
  1269. X    echo "Your C library seems to be in both /lib/clib and /lib/libc."
  1270. X    libc='/lib/clib /lib/libc'
  1271. X    if test -f /lib/syslib; then
  1272. X        echo "(Your math library is in /lib/syslib.)"
  1273. X        libc="$libc /lib/syslib"
  1274. X    fi
  1275. elif test -f "$libc"; then
  1276. X    echo "Your C library seems to be in $libc, as you said before."
  1277. elif test -f $incpath/usr/lib/libc.a; then
  1278. X    libc=$incpath/usr/lib/libc.a;
  1279. X    echo "Your C library seems to be in $libc.  That's fine."
  1280. elif test -f /lib/libc.a; then
  1281. X    libc=/lib/libc.a;
  1282. X    echo "Your C library seems to be in $libc.  You're normal."
  1283. else
  1284. X    if ans=`./loc libc.a blurfl/dyick $libpth`; test -f "$ans"; then
  1285. X        :
  1286. X    elif ans=`./loc libc blurfl/dyick $libpth`; test -f "$ans"; then
  1287. X        libnames="$libnames "`./loc clib blurfl/dyick $libpth`
  1288. X    elif ans=`./loc clib blurfl/dyick $libpth`; test -f "$ans"; then
  1289. X        :
  1290. X    elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
  1291. X        :
  1292. X    elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
  1293. X        :
  1294. X    else
  1295. X        ans=`./loc Llibc.a blurfl/dyick $xlibpth`
  1296. X    fi
  1297. X    if test -f "$ans"; then
  1298. X        echo "Your C library seems to be in $ans, of all places."
  1299. X        libc=$ans
  1300. X    else
  1301. X        libc='blurfl'
  1302. X    fi
  1303. fi
  1304. if $test -f "$libc"; then
  1305. X    dflt="$libc"
  1306. X    cat <<EOM
  1307. X
  1308. If the guess above is wrong (which it might be if you're using a strange
  1309. compiler, or your machine supports multiple models), you can override it here.
  1310. X
  1311. XEOM
  1312. else
  1313. X    dflt=''
  1314. X    echo $libpth | tr ' ' '\012' | sort | uniq > libpath
  1315. X    cat <<EOM
  1316. I can't seem to find your C library.  I've looked in the following places:
  1317. X
  1318. XEOM
  1319. X    $sed 's/^/    /' libpath
  1320. X    cat <<EOM
  1321. X
  1322. None of these seems to contain your C library. I need to get its name...
  1323. X
  1324. XEOM
  1325. fi
  1326. cont=true
  1327. while $test "$cont"; do
  1328. X    rp="Where is your C library?"
  1329. X    . myread
  1330. X    libc="$ans"
  1331. X    if $test -f "$libc"; then
  1332. X        cont=''
  1333. X    else
  1334. X        case "$fastread" in
  1335. X        yes) dflt=y;;
  1336. X        *) dflt=n;;
  1337. X        esac
  1338. X        rp="File $libc does not exist. Use that name anyway?"
  1339. X        . myread
  1340. X        case "$ans" in
  1341. X        y*) cont='';;
  1342. X        esac
  1343. X        dflt=''
  1344. X    fi
  1345. done
  1346. echo " "
  1347. echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
  1348. set X `cat libnames`
  1349. shift
  1350. xxx=files
  1351. case $# in 1) xxx=file; esac
  1352. echo "Extracting names from the following $xxx for later perusal:"
  1353. echo " "
  1354. X$sed 's/^/    /' libnames
  1355. echo " "
  1356. X$echo $n "This may take a while...$c"
  1357. nm $nm_opt $* 2>/dev/null >libc.tmp
  1358. X$echo $n ".$c"
  1359. X$grep fprintf libc.tmp > libc.ptf
  1360. xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c"'
  1361. xrun='eval "<libc.tmp $com >libc.list"; echo "done"'
  1362. if com="$sed -n -e 's/^.* [ADTS]  *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
  1363. X    eval $xscan;\
  1364. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1365. X        eval $xrun
  1366. elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
  1367. X    eval $xscan;\
  1368. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1369. X        eval $xrun
  1370. elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
  1371. X    eval $xscan;\
  1372. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1373. X        eval $xrun
  1374. elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
  1375. X    eval $xscan;\
  1376. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1377. X        eval $xrun
  1378. elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
  1379. X    eval $xscan;\
  1380. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1381. X        eval $xrun
  1382. elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
  1383. X    eval $xscan;\
  1384. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1385. X        eval $xrun
  1386. elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
  1387. X                -e '/ file/d' -e 's/^\([^     ]*\).*/\1/p'";\
  1388. X    eval $xscan;\
  1389. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1390. X        eval $xrun
  1391. elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
  1392. X    eval $xscan;\
  1393. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1394. X        eval $xrun
  1395. elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
  1396. X    eval $xscan;\
  1397. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1398. X        eval $xrun
  1399. else
  1400. X    nm -p $* 2>/dev/null >libc.tmp
  1401. X    com="$sed -n -e 's/^.* [ADTS]  *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
  1402. X    eval "<libc.tmp $com >libc.list"
  1403. X    if $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1404. X        nm_opt='-p'
  1405. X        echo "done"
  1406. X    else
  1407. X        echo " "
  1408. X        echo "nm didn't seem to work right. Trying ar instead..."
  1409. X        com=''
  1410. X        if ar t $libc > libc.tmp; then
  1411. X            for thisname in $libnames; do
  1412. X                ar t $thisname >>libc.tmp
  1413. X            done
  1414. X            $sed -e 's/\.o$//' < libc.tmp > libc.list
  1415. X            echo "Ok."
  1416. X        else
  1417. X            echo "ar didn't seem to work right."
  1418. X            echo "Maybe this is a Cray...trying bld instead..."
  1419. X            if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
  1420. X                for thisname in $libnames; do
  1421. X                    bld t $libnames | \
  1422. X                    $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
  1423. X                    ar t $thisname >>libc.tmp
  1424. X                done
  1425. X                echo "Ok."
  1426. X            else
  1427. X                echo "That didn't work either.  Giving up."
  1428. X                exit 1
  1429. X            fi
  1430. X        fi
  1431. X    fi
  1432. fi
  1433. nm_extract="$com"
  1434. if test -f /lib/syscalls.exp; then
  1435. X    echo " "
  1436. X    echo "Also extracting names from /lib/syscalls.exp for good ole AIX..."
  1437. X    $sed -n 's/^\([^     ]*\)[     ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
  1438. fi
  1439. X$rm -f libnames libpath
  1440. X
  1441. X: set up the script used to warn in case of inconsistency
  1442. cat <<'EOSC' >whoa
  1443. dflt=y
  1444. echo ' '
  1445. echo "*** WHOA THERE!!! ***"
  1446. echo "    The $hint value for \$$var on this machine was \"$was\"!"
  1447. rp="    Keep the $hint value?"
  1448. X. myread
  1449. case "$ans" in
  1450. y) td=$was; tu=$was;;
  1451. esac
  1452. XEOSC
  1453. X
  1454. X: define an is-in-libc? function
  1455. inlibc='echo " "; td=$define; tu=$undef;
  1456. var=$2; eval "was=\$$2";
  1457. if $contains "^$1\$" libc.list >/dev/null 2>&1;
  1458. then echo "$1() found.";
  1459. X    eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
  1460. else echo "$1() not found.";
  1461. X    eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi'
  1462. X
  1463. X: see if getopt exists
  1464. set getopt d_getopt
  1465. eval $inlibc
  1466. X
  1467. X: function used to set $1 to $val
  1468. setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
  1469. case "$val$was" in
  1470. X$define$undef) . whoa; eval "$var=\$td";;
  1471. X$undef$define) . whoa; eval "$var=\$tu";;
  1472. X*) eval "$var=$val";;
  1473. esac'
  1474. X
  1475. X: see which of string.h or strings.h is needed
  1476. echo " "
  1477. strings=`loc string.h "" $usrinc $inclwanted`
  1478. val="$undef"
  1479. if $test -r "$strings"; then
  1480. X    echo "Using <string.h> instead of <strings.h>."
  1481. X    if bsd; then
  1482. X        echo "(Actually, this looks more like it were an USG system)"
  1483. X    fi
  1484. X    val="$define"
  1485. else
  1486. X    strings=`loc strings.h "" $usrinc $inclwanted`
  1487. X    if $test -r "$strings"; then
  1488. X        echo "Using <strings.h> instead of <string.h>."
  1489. X        if usg; then
  1490. X            echo "(Actually, this looks more like it were a BSD system)"
  1491. X        fi
  1492. X    else
  1493. X        echo "No string header found--You'll surely have problems."
  1494. X    fi
  1495. fi
  1496. set i_string
  1497. eval $setvar
  1498. X
  1499. X: index or strchr
  1500. echo " "
  1501. case "$d_index" in
  1502. n) dflt=n;;
  1503. X*) dflt=y;;
  1504. esac
  1505. if $contains '^index$' libc.list >/dev/null 2>&1 ; then
  1506. X    if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
  1507. X        if $contains strchr "$strings" >/dev/null 2>&1 ; then
  1508. X            if $contains index "$strings" >/dev/null 2>&1 ; then
  1509. X                echo "Your system has both index() and strchr()."
  1510. X                rp="Shall I use index() rather than strchr()?"
  1511. X                . myread
  1512. X                case "$ans" in
  1513. X                    n*) val="$define" ;;
  1514. X                    *)  val="$undef" ;;
  1515. X                esac
  1516. X            else
  1517. X                val="$define"
  1518. X                echo "strchr() found."
  1519. X            fi
  1520. X        else
  1521. X            val="$undef"
  1522. X            echo "index() found."
  1523. X        fi
  1524. X    else
  1525. X        val="$undef"
  1526. X        echo "index() found."
  1527. X    fi
  1528. else
  1529. X    if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
  1530. X        val="$define"
  1531. X        echo "strchr() found."
  1532. X    else
  1533. X        echo "No index() or strchr() found!"
  1534. X        val="$undef"
  1535. X    fi
  1536. fi
  1537. set d_index
  1538. eval $setvar
  1539. X
  1540. X: see if memcpy exists
  1541. set memcpy d_memcpy
  1542. eval $inlibc
  1543. X
  1544. X: see if memset exists
  1545. set memset d_memset
  1546. eval $inlibc
  1547. X
  1548. X: see how we invoke the C preprocessor
  1549. echo " "
  1550. echo "Now, how can we feed standard input to your C preprocessor..."
  1551. cat <<'EOT' >testcpp.c
  1552. X#define ABC abc
  1553. X#define XYZ xyz
  1554. ABC.XYZ
  1555. XEOT
  1556. cd ..
  1557. echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
  1558. chmod 755 cppstdin
  1559. wrapper=`pwd`/cppstdin
  1560. cd UU
  1561. if test "X$cppstdin" != "X" && \
  1562. X    $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
  1563. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1564. X    echo "You used to use $cppstdin $cppminus so we'll use that again."
  1565. elif test "$cc" = gcc && \
  1566. X    (echo "Using gcc, eh?  We'll try to force gcc -E using a wrapper..."; \
  1567. X    $wrapper <testcpp.c >testcpp.out 2>&1; \
  1568. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
  1569. X    echo "Yup, we can."
  1570. X    cppstdin="$wrapper"
  1571. X    cppminus='';
  1572. elif echo 'Maybe "'"$cc"' -E" will work...'; \
  1573. X    $cc -E <testcpp.c >testcpp.out 2>&1; \
  1574. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1575. X    echo "Yup, it does."
  1576. X    cppstdin="$cc -E"
  1577. X    cppminus='';
  1578. elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
  1579. X    $cc -E - <testcpp.c >testcpp.out 2>&1; \
  1580. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1581. X    echo "Yup, it does."
  1582. X    cppstdin="$cc -E"
  1583. X    cppminus='-';
  1584. elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
  1585. X    $wrapper <testcpp.c >testcpp.out 2>&1; \
  1586. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1587. X    cppstdin="$wrapper"
  1588. X    cppminus=''
  1589. X    echo "Eureka!"
  1590. elif echo 'No such luck, maybe "'$cpp'" will work...'; \
  1591. X    $cpp <testcpp.c >testcpp.out 2>&1; \
  1592. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1593. X    echo "It works!"
  1594. X    cppstdin="$cpp"
  1595. X    cppminus='';
  1596. elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
  1597. X    $cpp - <testcpp.c >testcpp.out 2>&1; \
  1598. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1599. X    echo "Hooray, it works!  I was beginning to wonder."
  1600. X    cppstdin="$cpp"
  1601. X    cppminus='-';
  1602. elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
  1603. X    $cc -P <testcpp.c >testcpp.out 2>&1; \
  1604. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1605. X    echo "Yipee, that works!"
  1606. X    cppstdin="$cc -P"
  1607. X    cppminus='';
  1608. elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
  1609. X    $cc -P - <testcpp.c >testcpp.out 2>&1; \
  1610. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1611. X    echo "At long last!"
  1612. X    cppstdin="$cc -P"
  1613. X    cppminus='-';
  1614. else
  1615. X    dflt=''
  1616. X    rp="No dice.  I can't find a C preprocessor.  Name one:"
  1617. X    . myread
  1618. X    cppstdin="$ans"
  1619. X    $cppstdin <testcpp.c >testcpp.out 2>&1
  1620. X    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1621. X        echo "OK, that will do."
  1622. X    else
  1623. X        echo "Sorry, I can't get that to work.  Go find one and rerun Configure."
  1624. X        exit 1
  1625. X    fi
  1626. fi
  1627. X$rm -f testcpp.c testcpp.out
  1628. X
  1629. X: get C preprocessor symbols handy
  1630. echo " "
  1631. echo $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know
  1632. X$cat <<EOSS >Cppsym
  1633. X$startsh
  1634. case "\$1" in
  1635. X-l) list=true
  1636. X    shift
  1637. X    ;;
  1638. esac
  1639. unknown=''
  1640. case "\$list\$#" in
  1641. X1|2)
  1642. X    for sym do
  1643. X    if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  1644. X        exit 0
  1645. X    elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  1646. X        :
  1647. X    else
  1648. X        unknown="\$unknown \$sym"
  1649. X    fi
  1650. X    done
  1651. X    set X \$unknown
  1652. X    shift
  1653. X    ;;
  1654. esac
  1655. case \$# in
  1656. X0) exit 1;;
  1657. esac
  1658. echo \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\
  1659. X#ifdef \1\\
  1660. exit 0; _ _ _ _\1\\     \1\\
  1661. X#endif\\
  1662. X/' >Cppsym\$\$
  1663. echo exit 1 >>Cppsym\$\$
  1664. X$cppstdin $cppminus <Cppsym\$\$ >Cppsym2\$\$
  1665. case "\$list" in
  1666. true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
  1667. X*)
  1668. X    sh Cppsym2\$\$
  1669. X    status=\$?
  1670. X    ;;
  1671. esac
  1672. X$rm -f Cppsym\$\$ Cppsym2\$\$
  1673. exit \$status
  1674. XEOSS
  1675. chmod +x Cppsym
  1676. X$eunicefix Cppsym
  1677. echo "Your C preprocessor defines the following symbols:"
  1678. Cppsym -l $attrlist >Cppsym.true
  1679. X$cat Cppsym.true
  1680. rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
  1681. X
  1682. X: see if this is a termio system
  1683. val="$undef"
  1684. val2="$undef"
  1685. val3="$undef"
  1686. if $test -r $usrinc/termios.h ; then
  1687. X    set tcsetattr i_termios
  1688. X    eval $inlibc
  1689. X    val3="$i_termios"
  1690. fi
  1691. echo " "
  1692. case "$val3" in
  1693. X"$define") echo "You have POSIX termios.h... good!";;
  1694. X*) if Cppsym pyr; then
  1695. X        case "`bin/universe`" in
  1696. X        ucb) if $test -r $usrinc/sgtty.h; then
  1697. X                val2="$define"
  1698. X                echo "<sgtty.h> found."
  1699. X            else
  1700. X                echo "System is pyramid with BSD universe."
  1701. X                echo "<sgtty.h> not found--you could have problems."
  1702. X            fi;;
  1703. X        *) if $test -r $usrinc/termio.h; then
  1704. X                val="$define"
  1705. X                echo "<termio.h> found."
  1706. X            else
  1707. X                echo "System is pyramid with USG universe."
  1708. X                echo "<termio.h> not found--you could have problems."
  1709. X            fi;;
  1710. X        esac
  1711. X    elif usg; then
  1712. X        if $test -r $usrinc/termio.h ; then
  1713. X            echo "<termio.h> found."
  1714. X            val="$define"
  1715. X        elif $test -r $usrinc/sgtty.h ; then
  1716. X            echo "<sgtty.h> found."
  1717. X            val2="$define"
  1718. X        else
  1719. X            echo "Neither <termio.h> nor <sgtty.h> found--you could have problems."
  1720. X        fi
  1721. X    else
  1722. X        if $test -r $usrinc/sgtty.h ; then
  1723. X            echo "<sgtty.h> found."
  1724. X            val2="$define"
  1725. X        elif $test -r $usrinc/termio.h ; then
  1726. X            echo "<termio.h> found."
  1727. X            val="$define"
  1728. X        else
  1729. X            echo "Neither <sgtty.h> nor <termio.h> found--you could have problems."
  1730. X        fi
  1731. X    fi;;
  1732. esac
  1733. set i_termio; eval $setvar
  1734. val=$val2; set i_sgtty; eval $setvar
  1735. val=$val3; set i_termios; eval $setvar
  1736. X
  1737. X: see if ioctl defs are in sgtty/termio or sys/ioctl
  1738. echo " "
  1739. if $test -r $usrinc/sys/ioctl.h ; then
  1740. X    val="$define"
  1741. X    echo "<sys/ioctl.h> found."
  1742. else
  1743. X    val="$undef"
  1744. X    $test $i_termio = "$define" && xxx="termio.h"
  1745. X    $test $i_termios = "$define" && xxx="termios.h"
  1746. X    $test $i_sgtty = "$define" && xxx="sgtty.h"
  1747. X    echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>."
  1748. fi
  1749. set i_sysioctl
  1750. eval $setvar
  1751. X
  1752. X: see if signal is declared as pointer to function returning int or void
  1753. echo " "
  1754. X$cppstdin $cppminus $cppflags < $usrinc/signal.h >$$.tmp
  1755. if $contains 'int.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  1756. X    echo "You have int (*signal())() instead of void."
  1757. X    val="$undef"
  1758. X    signal_t="int"
  1759. elif $contains 'void.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  1760. X    echo "You have void (*signal())() instead of int."
  1761. X    val="$define"
  1762. X    signal_t="void"
  1763. elif $contains 'extern[     ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
  1764. X    echo "You have int (*signal())() instead of void."
  1765. X    val="$undef"
  1766. X    signal_t="int"
  1767. else
  1768. X    case "$d_voidsig" in
  1769. X    '') echo "I can't determine whether signal handler returns void or int..."
  1770. X        dflt=void
  1771. X        rp="What type does your signal handler returns?"
  1772. X        . myread
  1773. X        case "$ans" in
  1774. X        void) val="$define"; signal_t="void";;
  1775. X        *) val="$undef"; signal_t="int";;
  1776. X        esac;;
  1777. X    *) echo "As you already told me, signal handler returns $signal_t.";;
  1778. X    esac
  1779. fi
  1780. set d_voidsig
  1781. eval $setvar
  1782. X$rm -f $$.tmp
  1783. X
  1784. X: check for void type
  1785. echo " "
  1786. X$cat <<EOM
  1787. Checking to see how well your C compiler groks the void type...
  1788. X
  1789. X  Support flag bits are:
  1790. X    1: basic void declarations.
  1791. X    2: arrays of pointers to functions returning void.
  1792. X    4: operations between pointers to and addresses of void functions.
  1793. X    8: generic void pointers.
  1794. X
  1795. XEOM
  1796. case "$voidflags" in
  1797. X'')
  1798. X    $cat >try.c <<'EOCP'
  1799. X#if TRY & 1
  1800. void main() {
  1801. X#else
  1802. main() {
  1803. X#endif
  1804. X    extern void moo();    /* function returning void */
  1805. X    void (*goo)();        /* ptr to func returning void */
  1806. X#if TRY & 8
  1807. X    void *hue;        /* generic ptr */
  1808. X#endif
  1809. X#if TRY & 2
  1810. X    void (*foo[10])();
  1811. X#endif
  1812. X
  1813. X#if TRY & 4
  1814. X    if(goo == moo) {
  1815. X        exit(0);
  1816. X    }
  1817. X#endif
  1818. X    exit(0);
  1819. X}
  1820. XEOCP
  1821. X    if $cc -S -DTRY=$defvoidused try.c >.out 2>&1 ; then
  1822. X        voidflags=$defvoidused
  1823. X    echo "It appears to support void to the level $package wants ($defvoidused)."
  1824. X        if $contains warning .out >/dev/null 2>&1; then
  1825. X            echo "However, you might get some warnings that look like this:"
  1826. X            $cat .out
  1827. X        fi
  1828. X    else
  1829. X        echo "Hmm, your compiler has some difficulty with void.  Checking further..."
  1830. X        if $cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
  1831. X            echo "It supports 1..."
  1832. X            if $cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
  1833. X                echo "It also supports 2..."
  1834. X                if $cc -S -DTRY=7 try.c >/dev/null 2>&1 ; then
  1835. X                    voidflags=7
  1836. X                    echo "And it supports 4 but not 8 definitely."
  1837. X                else
  1838. X                    echo "It doesn't support 4..."
  1839. X                    if $cc -S -DTRY=11 try.c >/dev/null 2>&1 ; then
  1840. X                        voidflags=11
  1841. X                        echo "But it supports 8."
  1842. X                    else
  1843. X                        voidflags=3
  1844. X                        echo "Neither does it support 8."
  1845. X                    fi
  1846. X                fi
  1847. X            else
  1848. X                echo "It does not support 2..."
  1849. X                if $cc -S -DTRY=13 try.c >/dev/null 2>&1 ; then
  1850. X                    voidflags=13
  1851. X                    echo "But it supports 4 and 8."
  1852. X                else
  1853. X                    if $cc -S -DTRY=5 try.c >/dev/null 2>&1 ; then
  1854. X                        voidflags=5
  1855. X                        echo "And it supports 4 but has not heard about 8."
  1856. X                    else
  1857. X                        echo "However it supports 8 but not 4."
  1858. X                    fi
  1859. X                fi
  1860. X            fi
  1861. X        else
  1862. X            echo "There is no support at all for void."
  1863. X            voidflags=0
  1864. X        fi
  1865. X    fi
  1866. esac
  1867. dflt="$voidflags";
  1868. rp="Your void support flags add up to what?"
  1869. X. myread
  1870. voidflags="$ans"
  1871. X$rm -f try.* .out
  1872. X
  1873. X: preserve RCS keywords in files with variable substitution, grrr
  1874. Id='$Id'
  1875. Log='$Log'
  1876. X
  1877. X: determine where public executables go
  1878. case "$bin" in
  1879. X'')
  1880. X    dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
  1881. X    ;;
  1882. X*)  dflt="$bin"
  1883. X    ;;
  1884. esac
  1885. cont=true
  1886. while $test "$cont" ; do
  1887. X    echo " "
  1888. X    rp="Where do you want to put the public executables? (~name ok)"
  1889. X    . myread
  1890. X    bin="$ans"
  1891. X    bin=`filexp $bin`
  1892. X    if test -d $bin; then
  1893. X    cont=''
  1894. X    else
  1895. X    dflt=n
  1896. X    rp="Directory $bin doesn't exist.  Use that name anyway?"
  1897. X    . myread
  1898. X    dflt=''
  1899. X    case "$ans" in
  1900. X    y*) cont='';;
  1901. X    esac
  1902. X    fi
  1903. done
  1904. X
  1905. X: see if we need -o option for tar
  1906. echo " "
  1907. case "$d_taropt_o" in
  1908. X'') if $test -f "$tar"; then
  1909. X        if $tar -cf - /dev/null 2>/dev/null | $tar -xof - >/dev/null 2>&1; then
  1910. X            val="$define"
  1911. X        else
  1912. X            val="$undef"
  1913. X        fi
  1914. X    else
  1915. X        val="$undef"
  1916. X    fi;;
  1917. X*) val="$d_taropt_o";;
  1918. esac
  1919. case "$val" in
  1920. X"$define") echo "I'll use the -o option with tar upon archive extraction.";;
  1921. X*) echo "Your tar does not seem to support the -o option. I'll ignore it then.";;
  1922. esac
  1923. set d_taropt_o
  1924. eval $setvar
  1925. X
  1926. X: determine default editor
  1927. case "$defeditor" in
  1928. X'')
  1929. X    case "$_vi" in
  1930. X    */*) dflt="$_vi";;
  1931. X    *) dflt=/usr/ucb/vi;;
  1932. X    esac
  1933. X    ;;
  1934. X*)  dflt="$defeditor"
  1935. X    ;;
  1936. esac
  1937. cont=true
  1938. while $test "$cont" ; do
  1939. X    echo " "
  1940. X    rp="What is the default editor on your system?"
  1941. X    . myread
  1942. X    defeditor="$ans"
  1943. X    if test -f $ans; then
  1944. X        cont=''
  1945. X    else
  1946. X        dflt=n
  1947. X        rp="File $ans doesn't exist.  Use that name anyway?"
  1948. X        . myread
  1949. X        dflt=''
  1950. X        case "$ans" in
  1951. X        y*) cont='';;
  1952. X        esac
  1953. X    fi
  1954. done
  1955. X
  1956. X: determine the name of a reasonable mailer
  1957. case "$mailer" in
  1958. X'')
  1959. X    if $test -f "$sendmail"; then
  1960. X        dflt="$sendmail"
  1961. X    elif $test -f "$rmail"; then
  1962. X        dflt="$rmail"
  1963. X    elif $test -f /bin/mail; then
  1964. X        dflt=/bin/mail
  1965. X    else
  1966. X        dflt=$mail
  1967. X    fi
  1968. X    ;;
  1969. X*)  dflt="$mailer";;
  1970. esac
  1971. cont=true
  1972. while $test "$cont" ; do
  1973. X    cat <<EOM
  1974. X
  1975. I need the full pathname of the program used to deliver mail on your system.
  1976. A typical answer would be /usr/lib/sendmail or /bin/rmail, but you may choose
  1977. any other program, as long as $package can feed its standard input.
  1978. X
  1979. XEOM
  1980. X    rp="Mail transport agent to be used?"
  1981. X    . myread
  1982. X    mailer="$ans"
  1983. X    if test -f $ans; then
  1984. X        cont=''
  1985. X    else
  1986. X        dflt=n
  1987. X        rp="File $ans doesn't exist.  Use that name anyway?"
  1988. X        . myread
  1989. X        dflt=''
  1990. X        case "$ans" in
  1991. X        y*) cont='';;
  1992. X        esac
  1993. X    fi
  1994. done
  1995. X
  1996. X: determine where manual pages go
  1997. X$cat <<EOM
  1998. X
  1999. X$package has manual pages available in source form.
  2000. XEOM
  2001. case "$nroff" in
  2002. nroff)
  2003. X    echo "However, you don't have nroff, so they're probably useless to you."
  2004. X    case "$mansrc" in
  2005. X    '') mansrc="none";;
  2006. X    esac;;
  2007. esac
  2008. echo "If you don't want the manual sources installed, answer 'none'."
  2009. case "$mansrc" in
  2010. X'')
  2011. X    dflt="$sysman"
  2012. X    ;;
  2013. X*)  dflt="$mansrc"
  2014. X    ;;
  2015. esac
  2016. cont=true
  2017. while $test "$cont" ; do
  2018. X    echo " "
  2019. X    rp="Where do the manual pages (source) go? (~name ok)"
  2020. X    . myread
  2021. X    case "$ans" in
  2022. X    'none') mansrc=''
  2023. X        cont='';;
  2024. X    *)
  2025. X        mansrc=`filexp "$ans"`
  2026. X        if test -d "$mansrc"; then
  2027. X            cont=''
  2028. X        else
  2029. X            dflt=n
  2030. X            rp="Directory $mansrc doesn't exist.  Use that name anyway?"
  2031. X            . myread
  2032. X            dflt=''
  2033. X            case "$ans" in
  2034. X            y*) cont='';;
  2035. X            esac
  2036. X        fi;;
  2037. X    esac
  2038. done
  2039. case "$mansrc" in
  2040. X'') manext='0';;
  2041. X*l) manext=l;;
  2042. X*n) manext=n;;
  2043. X*o) manext=l;;
  2044. X*p) manext=n;;
  2045. X*C) manext=C;;
  2046. X*L) manext=L;;
  2047. X*) manext=1;;
  2048. esac
  2049. X
  2050. X: decide how portable to be
  2051. case "$d_portable" in
  2052. X"$define") dflt=y;;
  2053. X*)    dflt=n;;
  2054. esac
  2055. X$cat <<'EOH'
  2056. I can set things up so that your shell scripts and binaries are more portable,
  2057. at what may be a noticable cost in performance.  In particular, if you
  2058. ask to be portable, the following happens:
  2059. X
  2060. X     1) Shell scripts will rely on the PATH variable rather than using
  2061. X    the paths derived above.
  2062. X     2) ~username interpretations will be done at run time rather than
  2063. X    by Configure.
  2064. X
  2065. XEOH
  2066. rp="Do you expect to run these scripts and binaries on multiple machines?"
  2067. X. myread
  2068. case "$ans" in
  2069. X    y*) d_portable="$define"
  2070. X    for file in $loclist; do
  2071. X        eval $file=$file
  2072. X    done
  2073. X    ;;
  2074. X    *)  d_portable="$undef" ;;
  2075. esac
  2076. X
  2077. X: determine where private executables go
  2078. case "$privlib" in
  2079. X'')
  2080. X    dflt=/usr/lib/$package
  2081. X    test -d /usr/local/lib && dflt=/usr/local/lib/$package
  2082. X    ;;
  2083. X*)  dflt="$privlib"
  2084. X    ;;
  2085. esac
  2086. X$cat <<EOM
  2087. X
  2088. The $package package has some auxiliary files that should be put in a library
  2089. that is accessible by everyone.  Where do you want to put these "private" but
  2090. accessible files?
  2091. X
  2092. XEOM
  2093. rp="Private library path? (~name ok)"
  2094. X. myread
  2095. privlib="$ans"
  2096. case "$d_portable" in
  2097. X"$undef")
  2098. X    privlib=`filexp $privlib`
  2099. X    ;;
  2100. esac
  2101. X
  2102. X: determine where public executables go
  2103. case "$scriptdir" in
  2104. X'')
  2105. X    dflt="$bin"
  2106. X    : guess some guesses
  2107. X    $test -d /usr/share/scripts && dflt=/usr/share/scripts
  2108. X    $test -d /usr/share/bin && dflt=/usr/share/bin
  2109. X    ;;
  2110. X*)  dflt="$scriptdir"
  2111. X    ;;
  2112. esac
  2113. cont=true
  2114. X$cat <<EOM
  2115. Some installations have a separate directory just for executable scripts so
  2116. that they can mount it across multiple architectures but keep the scripts in
  2117. one spot.  You might, for example, have a subdirectory of /usr/share for this.
  2118. Or you might just lump your scripts in with all your other executables.
  2119. XEOM
  2120. while $test "$cont" ; do
  2121. X    rp="Where do you keep publicly executable scripts? (~name ok)"
  2122. X    . myread
  2123. X    scriptdir="$ans"
  2124. X    scriptdir=`./filexp "$scriptdir"`
  2125. X    if $test -d $scriptdir; then
  2126. X    cont=''
  2127. X    else
  2128. X    case "$fastread" in
  2129. X    yes) dflt=y;;
  2130. X    *) dflt=n;;
  2131. X    esac
  2132. X    rp="Directory $scriptdir doesn't exist.  Use that name anyway?"
  2133. X    . myread
  2134. X    dflt=''
  2135. X    case "$ans" in
  2136. X    y*) cont='';;
  2137. X    esac
  2138. X    fi
  2139. done
  2140. X
  2141. echo " "
  2142. echo "End of configuration questions."
  2143. echo " "
  2144. X
  2145. X: create config.sh file
  2146. echo " "
  2147. if test -d ../UU; then
  2148. X    cd ..
  2149. fi
  2150. echo "Creating config.sh..."
  2151. X$spitshell <<EOT >config.sh
  2152. X$startsh
  2153. X#
  2154. X# This file was produced by running the Configure script. It holds all the
  2155. X# definitions figured out by Configure. Should you modify one of these values,
  2156. X# do not forget to propagate your changes by running "Configure -d". You may
  2157. X# instead choose to run each of the .SH files by yourself.
  2158. X#
  2159. X
  2160. d_eunice='$d_eunice'
  2161. d_xenix='$d_xenix'
  2162. d_bsd='$d_bsd'
  2163. define='$define'
  2164. eunicefix='$eunicefix'
  2165. Mcc='$Mcc'
  2166. awk='$awk'
  2167. bison='$bison'
  2168. cat='$cat'
  2169. chgrp='$chgrp'
  2170. chmod='$chmod'
  2171. chown='$chown'
  2172. compress='$compress'
  2173. cp='$cp'
  2174. cpio='$cpio'
  2175. cpp='$cpp'
  2176. csh='$csh'
  2177. date='$date'
  2178. echo='$echo'
  2179. egrep='$egrep'
  2180. emacs='$emacs'
  2181. expr='$expr'
  2182. grep='$grep'
  2183. inews='$inews'
  2184. less='$less'
  2185. line='$line'
  2186. lint='$lint'
  2187. ln='$ln'
  2188. lp='$lp'
  2189. lpr='$lpr'
  2190. ls='$ls'
  2191. mail='$mail'
  2192. mailx='$mailx'
  2193. make='$make'
  2194. mkdir='$mkdir'
  2195. more='$more'
  2196. mv='$mv'
  2197. nroff='$nroff'
  2198. perl='$perl'
  2199. pg='$pg'
  2200. pmake='$pmake'
  2201. pr='$pr'
  2202. rm='$rm'
  2203. rmail='$rmail'
  2204. sed='$sed'
  2205. sendmail='$sendmail'
  2206. sleep='$sleep'
  2207. smail='$smail'
  2208. sort='$sort'
  2209. submit='$submit'
  2210. tail='$tail'
  2211. tar='$tar'
  2212. tbl='$tbl'
  2213. test='$test'
  2214. touch='$touch'
  2215. tr='$tr'
  2216. troff='$troff'
  2217. uname='$uname'
  2218. uniq='$uniq'
  2219. uuname='$uuname'
  2220. vi='$vi'
  2221. zcat='$zcat'
  2222. Author='$Author'
  2223. Date='$Date'
  2224. Header='$Header'
  2225. Id='$Id'
  2226. Locker='$Locker'
  2227. Log='$Log'
  2228. RCSfile='$RCSfile'
  2229. Revision='$Revision'
  2230. Source='$Source'
  2231. State='$State'
  2232. bin='$bin'
  2233. byteorder='$byteorder'
  2234. cc='$cc'
  2235. ccflags='$ccflags'
  2236. ldflags='$ldflags'
  2237. cppflags='$cppflags'
  2238. optimize='$optimize'
  2239. contains='$contains'
  2240. cppstdin='$cppstdin'
  2241. cppminus='$cppminus'
  2242. d_getopt='$d_getopt'
  2243. d_index='$d_index'
  2244. d_memcpy='$d_memcpy'
  2245. d_memset='$d_memset'
  2246. d_portable='$d_portable'
  2247. d_voidsig='$d_voidsig'
  2248. signal_t='$signal_t'
  2249. defeditor='$defeditor'
  2250. i_string='$i_string'
  2251. strings='$strings'
  2252. i_sysioctl='$i_sysioctl'
  2253. i_bsdioctl='$i_bsdioctl'
  2254. i_syssockio='$i_syssockio'
  2255. d_voidtty='$d_voidtty'
  2256. i_termio='$i_termio'
  2257. i_sgtty='$i_sgtty'
  2258. i_termios='$i_termios'
  2259. libc='$libc'
  2260. nm_opt='$nm_opt'
  2261. libpth='$libpth'
  2262. plibpth='$plibpth'
  2263. libs='$libs'
  2264. mailer='$mailer'
  2265. mansrc='$mansrc'
  2266. manext='$manext'
  2267. n='$n'
  2268. c='$c'
  2269. package='$package'
  2270. privlib='$privlib'
  2271. scriptdir='$scriptdir'
  2272. spitshell='$spitshell'
  2273. shsharp='$shsharp'
  2274. sharpbang='$sharpbang'
  2275. startsh='$startsh'
  2276. sysman='$sysman'
  2277. usrinc='$usrinc'
  2278. mips='$mips'
  2279. incpath='$incpath'
  2280. mips_type='$mips_type'
  2281. voidflags='$voidflags'
  2282. defvoidused='$defvoidused'
  2283. d_taropt_o='$d_taropt_o'
  2284. XEOT
  2285. X
  2286. X: add special variables
  2287. test -f patchlevel.h && \
  2288. awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
  2289. echo "CONFIG=true" >>config.sh
  2290. X
  2291. X: propagate old symbols
  2292. if test -f UU/config.sh; then
  2293. X    <UU/config.sh sort | uniq >UU/oldconfig.sh
  2294. X    sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
  2295. X    sort | uniq -u >UU/oldsyms
  2296. X    set X `cat UU/oldsyms`
  2297. X    shift
  2298. X    case $# in
  2299. X    0) ;;
  2300. X    *)    echo "Hmm...You had some extra variables I don't know about...I'll try to keep 'em..."
  2301. X    for sym in `cat UU/oldsyms`; do
  2302. X        echo "    Propagating $hint variable "'$'"$sym..."
  2303. X        eval 'tmp="$'"${sym}"'"'
  2304. X        echo "$tmp" | \
  2305. X        sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
  2306. X    done
  2307. X    ;;
  2308. X    esac
  2309. fi
  2310. X
  2311. X: Finish up
  2312. CONFIG=true
  2313. X
  2314. echo " "
  2315. dflt=''
  2316. echo "If you didn't make any mistakes, then just type a carriage return here."
  2317. rp="If you need to edit config.sh, do it as a shell escape here:"
  2318. X. UU/myread
  2319. case "$ans" in
  2320. X'') ;;
  2321. X*) : in case they cannot read
  2322. X    eval $ans;;
  2323. esac
  2324. X. ./config.sh
  2325. X
  2326. echo " "
  2327. echo "Doing variable substitutions on .SH files..."
  2328. if test -f MANIFEST; then
  2329. X    set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
  2330. else
  2331. X    set x `find . -name "*.SH" -print`
  2332. fi
  2333. shift
  2334. case $# in
  2335. X0) set x *.SH; shift;;
  2336. esac
  2337. if test ! -f $1; then
  2338. X    shift
  2339. fi
  2340. for file in $*; do
  2341. X    case "$file" in
  2342. X    */*)
  2343. X    dir=`$expr X$file : 'X\(.*\)/'`
  2344. X    file=`$expr X$file : 'X.*/\(.*\)'`
  2345. X    (cd $dir && . $file)
  2346. X    ;;
  2347. X    *)
  2348. X    . $file
  2349. X    ;;
  2350. X    esac
  2351. done
  2352. if test -f config.h.SH; then
  2353. X    if test ! -f config.h; then
  2354. X    : oops, they left it out of MANIFEST, probably, so do it anyway.
  2355. X    . config.h.SH
  2356. X    fi
  2357. fi
  2358. X
  2359. if $contains '^depend:' Makefile >/dev/null 2>&1; then
  2360. X    dflt=n
  2361. X    $cat <<EOM
  2362. X
  2363. Now you need to generate make dependencies by running "make depend".
  2364. You might prefer to run it in background: "make depend > makedepend.out &"
  2365. It can take a while, so you might not want to run it right now.
  2366. X
  2367. XEOM
  2368. X    rp="Run make depend now?"
  2369. X    . UU/myread
  2370. X    case "$ans" in
  2371. X    y*) make depend
  2372. X    echo "Now you must run a make."
  2373. X    ;;
  2374. X    *)  echo "You must run 'make depend' then 'make'."
  2375. X    ;;
  2376. X    esac
  2377. elif test -f [Mm]akefile; then
  2378. X    echo " "
  2379. X    echo "Now you must run a make."
  2380. else
  2381. X    echo "Done."
  2382. fi
  2383. X
  2384. X$rm -f kit*isdone
  2385. X$rm -rf UU
  2386. X: end of Configure
  2387. END_OF_FILE
  2388. if test 53615 -ne `wc -c <'Configure'`; then
  2389.     echo shar: \"'Configure'\" unpacked with wrong size!
  2390. fi
  2391. chmod +x 'Configure'
  2392. # end of 'Configure'
  2393. fi
  2394. echo shar: End of archive 4 \(of 4\).
  2395. cp /dev/null ark4isdone
  2396. MISSING=""
  2397. for I in 1 2 3 4 ; do
  2398.     if test ! -f ark${I}isdone ; then
  2399.     MISSING="${MISSING} ${I}"
  2400.     fi
  2401. done
  2402. if test "${MISSING}" = "" ; then
  2403.     echo You have unpacked all 4 archives.
  2404.     rm -f ark[1-9]isdone
  2405. else
  2406.     echo You still need to unpack the following archives:
  2407.     echo "        " ${MISSING}
  2408. fi
  2409. ##  End of shell archive.
  2410. exit 0
  2411.